package com.example.lockandqueue;

public class SynchronizedMain {

    public synchronized void test(){
        System.out.println("1234567");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("sssss");
    }

    public void test1(){
        System.out.println("aaaaaa");
    }

    public static void main(String[] args) {
        SynchronizedMain synchronizedMain = new SynchronizedMain();
        SynchronizedMain synchronizedMain1 = new SynchronizedMain();
        new Thread(()->{
            synchronizedMain.test();
        }).start();
        new Thread(()->{
            synchronizedMain.test1();
        }).start();
        new Thread(()->{
            synchronizedMain.test();
        }).start();
//        new Thread(()->{
//            synchronizedMain1.test();
//        }).start();
    }


}
